﻿<?php
if(isset($_POST['submitlogin']))
{
	if(!empty($_POST['login']) and !empty($_POST['pass']))
	{
		if($_POST['login'] == 'admin' and $_POST['pass'] == '1234')
		{
			$_SESSION['logged'] = 1;
			$_SESSION['login'] = "admin";
?>	
	<script type="text/javascript">
   		window.location = "index.php"
    </script>
<?php
		}
		else
		{
?>			
	<script type="text/javascript">
		alert ("Помилка! Логін або пароль введено не вірно!");
	</script>
<?php
		}
	}
}
?>
<h1>Авторизація</h1>
<p>
<form name="authorization_form" method="post" action="" onsubmit="return validate_form();">
	<table align="center">
    	<tr>
        	<td height="30">Логін:
            <td><input type="text" name="login" />
        </tr>
        <tr>
        	<td height="30">Пароль:
        	<td><input type="password" name="pass" />
        </tr>
        <tr>
        	<td colspan="2" align="center" height="30"><input type="submit" name="submitlogin" value="Login"/>
        </tr>
    </table>
</form>